package com.personal.common.bean;

public class ResultMsg {
	private int code = 200;//200
	private String message = "成功";//提示
	private Object data;
	private boolean isSuccess = true;
	
	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public boolean isSuccess() {
		return isSuccess;
	}

	public void setSuccess(boolean isSuccess) {
		this.isSuccess = isSuccess;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public ResultMsg() {
	}

	public ResultMsg(int code, String message) {
		this.code = code;
		this.message = message;
	}

	public ResultMsg(Object data) {
		super();
		this.data = data;
		this.code = 200;
		this.message = "成功";
		this.isSuccess = true;
	}

	public ResultMsg(Object data, int code, String message,boolean isSuccess) {
		super();
		this.data = data;
		this.code = code;
		this.message = message;
		this.isSuccess = isSuccess;
	}
	public ResultMsg(int code, String message,boolean isSuccess){
		super();
		this.code = code;
		this.message = message;
		this.isSuccess = isSuccess;
	}
	
	public static ResultMsg error() {
		return error(500, "未知异常，请联系管理员");
	}
	
	public static ResultMsg error(String msg) {
		return error(500, msg);
	}
	
	public static ResultMsg error(int code, String msg) {
		ResultMsg r = new ResultMsg();
		r.setCode(code);
		r.setMessage(msg);
		return r;
	}
}
